<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>最简单购物车加购</title>
</head>

<body>
	单价：<span class="sp2">100</span>
	数量：<span class="sp1">1</span>
	<button class="bt1">+</button>
	总价：<span class="sp3">100</span>
	<script>
		var bt1=document.querySelector(".bt1")
		
		bt1.onclick=function(){
			var sp1=document.querySelector(".sp1")
			var num=sp1.innerHTML;
			num++;
			sp1.innerHTML=num;
			var sp2=document.querySelector(".sp2")
			var price=sp2.innerHTML;
			var sum=num*price;
			var sp3=document.querySelector(".sp3")
			sp3.innerHTML=sum;
		}
	</script>
</body>
</html>